import {
    Dimensions,
    PixelRatio,
} from 'react-native';


export const deviceWidth = Dimensions.get('window').width;      //设备的宽度
export const deviceHeight = Dimensions.get('window').height;    //设备的高度
let fontScale = PixelRatio.getFontScale();                      //返回字体大小缩放比例

const scale = Math.min(deviceHeight / 800, deviceWidth / 1280);   //获取缩放比例
/**
 * 设置text为sp
 * @param size sp
 * return number dp
 */
export function setSpText(size) {
    return Math.ceil(size * scale);
}

//console.log("fontScale",fontScale, pixelRatio);

export function scaleSize(size) {
    return Math.ceil(size * scale);
}